﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace University.Workshop.Tests
{
    
    
    
    [TestClass()]
    public class ClientControllerTest
    {


        private TestContext testContextInstance;

       
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


       
        [TestMethod()]
        public void RegisterClientPassControllerTest()
        {
            Random ran = new Random();
            int num = ran.Next(10000);
            string clientNit = num.ToString(System.Globalization.CultureInfo.CurrentCulture); 
            string clientName = "juan"; 
            string clientSurname1 = "soliz"; 
            string clientSurname2 = "butron"; 
            string clientPhone = string.Empty; 
            string clientCellPhone = string.Empty; 
            string clientEmail = string.Empty; 
            string clientAddress = string.Empty; 
            bool expected = true; 
            bool actual;
            actual = ClientController.RegisterClient(clientNit, clientName, clientSurname1, clientSurname2, clientPhone, clientCellPhone, clientEmail, clientAddress);
            Assert.AreEqual(expected, actual);
        }
        [TestMethod()]
        public void RegisterClientPassControllerTest2()
        {
            string clientNit = string.Empty; 
            string clientName = "juan"; 
            string clientSurname1 = "soliz"; 
            string clientSurname2 = "butron"; 
            string clientPhone = string.Empty; 
            string clientCellPhone = string.Empty; 
            string clientEmail = string.Empty; 
            string clientAddress = string.Empty; 
            bool actual;
            actual = ClientController.RegisterClient(clientNit, clientName, clientSurname1, clientSurname2, clientPhone, clientCellPhone, clientEmail, clientAddress);
            Assert.IsFalse(actual);
        }

        
        [TestMethod()]
        public void ReviewIdIfNitRegisterTest()
        {
            string nit = "101010"; 
            bool expected = false; 
            bool actual;
            actual = ClientController.ReviewIdIfNitRegister(nit);
            Assert.AreEqual(expected, actual);
        }


        [TestMethod()]
        public void RegisterClientTest()
        {
            string clientNit = "101010";
            string clientName = "sadfasdf";
            string clientSurname1 = "asdfasf";
            string clientSurname2 = "asdfasf";
            string clientPhone = string.Empty;
            string clientCellPhone = string.Empty;
            string clientEmail = string.Empty;
            string clientAddress = string.Empty;
            bool expected = false;
            bool actual;
            actual = ClientController.RegisterClient(clientNit, clientName, clientSurname1, clientSurname2, clientPhone, clientCellPhone, clientEmail, clientAddress);
            Assert.AreEqual(expected, actual);

        }
        [TestMethod()]
        public void RegisterClientInvalidEmailTest()
        {
            string clientNit = "101010";
            string clientName = "sadfasdf";
            string clientSurname1 = "asdfasf";
            string clientSurname2 = "asdfasf";
            string clientPhone = string.Empty;
            string clientCellPhone = string.Empty;
            string clientEmail = "'javier@hotmail.com";
            string clientAddress = string.Empty;
            bool expected = false;
            bool actual;
            actual = ClientController.RegisterClient(clientNit, clientName, clientSurname1, clientSurname2, clientPhone, clientCellPhone, clientEmail, clientAddress);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void DeleteClientTest()
        {
            string value = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.DeleteClient(value);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyNameClientTest()
        {
            string name = "juan"; 
            string nit = "2454"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyNameClient(name, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyNameClientTest1()
        {
            string name = "juan"; 
            string nit = "10000"; 
            bool expected = false; 
            bool actual;
            actual = ClientController.ModifyNameClient(name, nit);
            Assert.AreNotEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyAddressClientTest()
        {
            string address = "mi casita"; 
            string nit = "4321"; 
            bool expected = false; 
            bool actual;
            actual = ClientController.ModifyAddressClient(address, nit);
            Assert.AreNotEqual(expected, actual);
        }


        [TestMethod()]
        public void ModifyCellClientTest()
        {
            string cell = "72712302"; 
            string nit = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyCellClient(cell, nit);
            Assert.AreEqual(expected, actual);
            }

        
        public void ModifyEmailClientTest()
        {
            string email = "juanjo@hotmail.com"; 
            string nit = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyEmailClient(email, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyEmailClientTest1()
        {
            string email = "juanjo@hotmail.com";
            string nit = "1110";
            bool expected = false; 
            bool actual;
            actual = ClientController.ModifyEmailClient(email, nit);
            Assert.AreNotEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyPhoneClientTest()
        {
            string phone = "4378730"; 
            string nit = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyPhoneClient(phone, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyMatNameClientTest()
        {
            string mat = "juancho"; 
            string nit = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyMatNameClient(mat, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyPatNameClientTest()
        {
            string pat = ""; 
            string nit = "11123"; 
            bool expected = false; 
            bool actual;
            actual = ClientController.ModifyPatNameClient(pat, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyPatNameClientTest1()
        {
            string pat = "Perez"; 
            string nit = "111"; 
            bool expected = true; 
            bool actual;
            actual = ClientController.ModifyPatNameClient(pat, nit);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ModifyNameClientTest2()
        {
            string name = ""; 
            string nit = "1112"; 
            bool expected = false; 
            bool actual;
            actual = ClientController.ModifyNameClient(name, nit);
            Assert.AreEqual(expected, actual);
        }
    }
}
